﻿$(document).ready(function () {

    //Determine if the browser is IE and less than version 9
    var bversion = parseInt($.browser.version, 10);
    var msie8OrUnder = ($.browser.msie != null) && (bversion < 9);
    var msie9OrUnder = ($.browser.msie != null) && (bversion < 10);
    if (!msie8OrUnder) {
        $('.roundblock').corner('10px');
        $('.roundblocksmall').corner('5px');
        $('.roundblockbottom').corner('10px bottom');
        $('.roundblocktop').corner('10px top');
    } //IE

    $('.nonfunc').click(function () {
        alert('Non-functional link');
        return false;
    });

    $('.expand-all').click(function () {
        $('.dimensionheader h4 .toggle').attr('expanded', '0');
        $('.dimensionheader h4').click();
        return false;
    });

    $('.collapse-all').click(function () {
        $('.dimensionheader h4 .toggle').attr('expanded', '1');
        $('.dimensionheader h4').click();
        return false;
    });

    $('.dimensionheader h4').click(function () {
        var icon = $(this).children('img:first-child');
        if (icon.attr('expanded') == '1') {
            //Is expanded
            icon.attr('src', '/images/dim-left.png');
            icon.attr('expanded', '0');
            icon.closest('.dimensionheader').next().slideUp(90);
        } else {
            //Is collapsed
            icon.attr('src', '/images/dim-down.png');
            icon.attr('expanded', '1');
            icon.closest('.dimensionheader').next().slideDown(90);
        }
    });

    $('a[asynch-load]').click(function () {
        if (!$(this).hasClass('noautoscroll')) {
            $("html, body").animate({ scrollTop: 0, x: 1 }, 500);
            var url = $(this).attr('href');
            if (url != null) {
                var delay = function () { window.location = url; };
                setTimeout(delay, 700);
                event.preventDefault();
            }
        }
    });

    //$('.fadein').hide();
    //$('.fadein').fadeIn('fast');

});

function showMore(panelid, label) {
    $(label).fadeOut(100);
    $('#' + panelid).slideDown();
}
